package intro.databases.gtCarRental.ui.admin;

import java.sql.ResultSet;
import java.sql.SQLException;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import intro.databases.gtCarRental.GTCRActivity;
import intro.databases.gtCarRental.R;

public class RevenueGeneratedReport extends GTCRActivity {
	LinearLayout table;

	@Override
	public void onCreate(Bundle b) {
		super.onCreate(b);
		setContentView(R.layout.revenue_generated_report);

		table = (LinearLayout) findViewById(R.id.linearLayout_revenueGeneratedReport_table);

		ResultSet rS = dbConn.revenueGenerated();
		try {
			while(rS.next()) {
				View v = getLayoutInflater().inflate(R.layout.revenue_generated_report_tablerow, null);

				TextView vehSNO = (TextView) v.findViewById(R.id.textView_revenueGeneratedReport_vehSNO);
				TextView type = (TextView) v.findViewById(R.id.textView_revenueGeneratedReport_type);
				TextView model = (TextView) v.findViewById(R.id.textView_revenueGeneratedReport_model);
				TextView resRev = (TextView) v.findViewById(R.id.textView_revenueGeneratedReport_resRev);
				TextView lateFee = (TextView) v.findViewById(R.id.textView_revenueGeneratedReport_lateFee);

				vehSNO.setText(rS.getString(1));
				type.setText(rS.getString(2));
				model.setText(rS.getString(3));
				resRev.setText(rS.getString(4));
				lateFee.setText(rS.getString(5));
				
				table.addView(v);
			}
		} 
		catch (SQLException e) { e.printStackTrace(); }
	}

}
